<template>
    <div>
        <ul>
            <li v-for="item in followList">
                {{item.username}}
                <el-button @click="cancel(item.id)">取消关注</el-button>
            </li>
        </ul>
    </div>
</template>

<script>
import $api from '../../../api/index'
export default {
    created(){
        this.getFollowList();
    },
    data(){
        return {
            followList:[]
        }
    },
    methods:{
        getFollowList(){
            $api.getFollowList().then(res => {
                console.log(res);
                if(res.code === 1){
                    this.followList = res.data;
                }
            })
        },
        cancel(id){
            $api.cancelFollow(id).then(res => {
                console.log(res);
                this.getFollowList()
            })
        }
    }
}
</script>
